<?php

/**
 * @author Barkowsky Igor
 * @copyright 2008
 * @name conf.php
 * @tutorial make all base connect to database and init all required classes and functions
 */
// start session and set error report to ALL
session_start();
error_reporting(E_ALL ^ E_NOTICE);
set_include_path($_SERVER['DOCUMENT_ROOT']);
// include const.php with main constants of site
include("root.php");
include("const.php");
include 'const_common.php';
// include modules from core
include $core['smarty'];
include_once $core['db'];
include_once $core['item'];
include_once $core['page'];
include_once $core['user'];
include_once $core['admin'];
include_once $core['images'];
include_once $core['category'];
include_once $core['comments'];
include_once $core['main'];
include_once $core['error'];
include_once $core['fileupload'];
$db = new DBx($database['host'],$database['database'],$database['user'],$database['password'],PFX);
function init_smarty($where = "")
{
    $time = time();

	if ($where == 'admin')
	{
		$smarty = new Smarty();

		$smarty->template_dir = ADMIN_DIR."/";
		$smarty->compile_dir = SMARTY_PATH.'admin/templates_c/';
		$smarty->config_dir = SMARTY_PATH.'admin/configs/';
		$smarty->cache_dir = SMARTY_PATH.'admin/cache/';
	}
	else
	{
		$smarty = new Smarty();

		$smarty->template_dir = ROOT_DIR."/";
		$smarty->compile_dir = SMARTY_PATH.'templates_c/';
		$smarty->config_dir = SMARTY_PATH.'configs/';
		$smarty->cache_dir = SMARTY_PATH.'cache/';
	}

    return $smarty;
}
?>